Top = ${shell pwd}
App = ${Top}/Application
BootLoader = ${Top}/Bootloader
#BinCreater = ${Top}/BinCreater/build
#Amp = ${BinCreater}/Amp
#AllBin = ${BinCreater}/AllInOne
#Bin = ${Top}/Bin

all: gd32

# creater:
# 	${info "make makefile first "}
# 	cd ${BinCreater} && cmake ../
# 	make -C ${BinCreater}

gd32:
	make -C ${App}
	make -C ${BootLoader}

# cp ${BootLoader}/build/BootLoader.bin ${Top}/BinFiles/
# cp ${App}/build/Application.bin ${Top}/BinFiles/
	
# amp:
# 	cd ${Amp} && ./ampcreater
# 	cd ${AllBin} && ./allinone

clean:
	rm -rf ${App}/build/*
	rm -rf ${BootLoader}/build/*
# rm -rf ${BinCreater}/*

gdboot:
	${info "start flash boot "}
	pyocd flash --erase auto --target GD32F303RC  --base-address 0x8000000   ./Bootloader/build/Bootloader.bin

gdapp:
	${info "start flash Application "}
	pyocd flash --erase auto --target GD32F303RC  --base-address 0x8007000   ./Application/build/Application.bin